package cn.shengchao.controler.ai.response;

import cn.shengchao.examstar.ai.application.dto.StudyDayDTO;
import cn.shengchao.examstar.knowledge.domain.entity.KnowledgePoint;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

/**
 * 知识点学习日程VO
 * 用于按知识点分组返回学习日程，支持树形结构
 */
@Data
@NoArgsConstructor
public class KnowledgePointStudyDayVO {
    /**
     * 知识点ID
     */
    private Long id;
    
    /**
     * 知识点名称
     */
    private String name;
    
    /**
     * 父知识点ID
     */
    private Long parentId;
    
    /**
     * 知识点路径
     */
    private String path;
    
    /**
     * 规格类型ID
     */
    private Long specificationTypeId;
    
    /**
     * 状态
     */
    private Integer status;
    
    /**
     * 该知识点下的学习日程列表
     */
    private List<StudyDayDTO> studyDays = new ArrayList<>();

    
    /**
     * 从KnowledgePoint构建
     */
    public static KnowledgePointStudyDayVO fromKnowledgePoint(KnowledgePoint knowledgePoint) {
        KnowledgePointStudyDayVO vo = new KnowledgePointStudyDayVO();
        vo.setId(knowledgePoint.getId());
        vo.setName(knowledgePoint.getName());
        vo.setParentId(knowledgePoint.getParentId());
        vo.setPath(knowledgePoint.getPath());
        vo.setSpecificationTypeId(knowledgePoint.getSpecificationTypeId());
        vo.setStatus(Math.toIntExact(knowledgePoint.getStatus()));
        return vo;
    }
} 